package com.gitee.fanx.rpc;

import java.net.URI;

/**
 * @author fanhang
 */
public class RpcConst {
	public static final String PATH = "/rpc";
	public static final String ACTION_NAME = "action";

	public static final String CONTENT_TYPE = "Content-Type";
	public static final String RPC_CONTENT_TYPE = "application/json";

	public static URI createUri(String serviceName, Class<?> apiClass, String methodName) {
		String routeName = routeName(apiClass, methodName);
		return URI.create("http://" + serviceName + PATH + "?" + ACTION_NAME + "=" + routeName);
	}

	public static String routeName(Class<?> apiClass, String methodName) {
		return apiClass.getSimpleName() + "." + methodName;
	}
}
